
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <meta name="layout" content="main" />
        <title>${Inter.printOut('Courses',session.language)}</title>
    </head>
    <body>
        <div class="undernav">
          <%
          def a = session.access
          a.refresh()
          %>
          
            <span class="menuButton"><g:link class="createCourse" action="create">${Inter.printOut('New Course',session.language)}</g:link></span>
          
            <!-- This is the help button. -->
            <%  def help = Help.findByNameAndLanguage("course_list", session.language)
            def helplink = createLink(action:'show', controller:'help', id: help?.id )%>
            <a href="#" class="menulink" onClick="MyWindow=window.open('${helplink}','Help','width=350,height=450'); return false;">${Inter.printOut('Help',session.language)}</a>
            <!-- This is the end of the help button. -->
        </div>
        <div class="body" style="width:98%">
            <h1>${Inter.printOut('Courses',session.language)}</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:if test="${courseInstanceList.size() < 1}">
              <div class="message">There is no courses in the system yet.</div>
            </g:if>
            <g:else>
              <div class="list">
                  <table class="sortableTable" style="table-layout: fixed">
                      <thead>
                          <tr>
                                  <th class="{sorter: 'link'}"><a href="#">${Inter.printOut('Course Code',session.language)}</a> </th>

                                  <th class="{sorter: 'link'}"><a href="#">${Inter.printOut('Name',session.language)}</a> </th>

                                  <g:if test="${session?.container && Container.get(session?.container)?.hasTab('boardName') || !session?.container}">
                                      <th class="{sorter: 'link'}"><a href="#">${Inter.printOut('Board Name',session.language)}</a> </th>
                                  </g:if>
                                  <th class="{sorter: 'text'}"><a href="#">${Inter.printOut('Level',session.language)}</a> </th>

                                  <th class="{sorter: 'text'}"><a href="#">${Inter.printOut('Area',session.language)}</a> </th>


                          </tr>
                      </thead>
                      <tbody>
                      <g:each in="${courseInstanceList}" status="i" var="courseInstance">
                          <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                              <td><g:link action="show" id="${courseInstance.id}">${fieldValue(bean:courseInstance, field:'activityId')}</g:link></td>

                              <td><g:link action="show" id="${courseInstance.id}">${fieldValue(bean:courseInstance, field:'name')}</g:link></td>

                              <g:if test="${session?.container && Container.get(session?.container)?.hasTab('boardName') || !session?.container}">
                                <td><g:link action="show" id="${courseInstance.id}">${fieldValue(bean:courseInstance, field:'boardName')}</g:link></td>
                              </g:if>

                              <td>${Inter.printOut(fieldValue(bean:courseInstance, field:'level'),session.language)}</td>

                              <td>${fieldValue(bean:courseInstance, field:'area')}</td>

                          </tr>
                      </g:each>
                      </tbody>
                  </table>
              </div>
              <div class="paginateButtons">
                  <g:paginate total="${courseInstanceTotal}" />
              </div>
            </g:else>
        </div>
    </body>
</html>
